import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:village_android/model/user_model.dart';

class MemberHeader extends StatelessWidget {
  UserModel userModel;

  MemberHeader({this.userModel});

  @override
  Widget build(BuildContext context) {
    return Container(
      height: ScreenUtil().setHeight(180),
      width: ScreenUtil().setWidth(800),
      alignment: Alignment.center,
      padding: EdgeInsets.all(10.0),
      margin: EdgeInsets.all(10.0),
      color: Colors.white30,
      child: Row(
        children: <Widget>[
          ClipRRect(
            borderRadius: BorderRadius.circular(30),
            child: Image.network(
              userModel.avatar,
              height: 60,
              width: 60,
              fit: BoxFit.fill,
            ),
          ),
          Padding(padding: EdgeInsets.only(left: 15)),
          Expanded(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.stretch,
              children: <Widget>[
                Text(
                  this.userModel.name,
                  maxLines: 1,
                  overflow: TextOverflow.ellipsis,
                  style: TextStyle(
                    fontSize: 15,
                    color: Color(0xFF999999),
                  ),
                ),
                Padding(padding: EdgeInsets.only(top: 2)),
                Row(
                  children: <Widget>[
                    Text(
                      this.userModel.villageJob,
                      style: TextStyle(
                        fontSize: 15,
                        fontWeight: FontWeight.w500,
                        color: Colors.black,
                      ),
                    ),
                    Padding(padding: EdgeInsets.only(right: 5)),
                    ClipRRect(
                      borderRadius: BorderRadius.circular(10.0),
                      child: Container(
                        padding: EdgeInsets.fromLTRB(10, 2, 10, 2),
                        color: Colors.red,
                        child: Text(
                          this.userModel.partyJob,
                          style: TextStyle(
                            fontSize: 14,
                            fontWeight: FontWeight.w500,
                            color: Colors.white,
                          ),
                        ),
                      ),
                    ),
                  ],
                ),
                Padding(padding: EdgeInsets.only(top: 2)),
                Text(
                  this.userModel.phone,
                  maxLines: 1,
                  overflow: TextOverflow.ellipsis,
                  style: TextStyle(
                    fontSize: 15,
                    color: Color(0xFF999999),
                  ),
                ),
                Padding(padding: EdgeInsets.only(top: 2)),
              ],
            ),
          ),
        ],
      ),
    );
  }
}
